package p3;

import java.util.Scanner;

/**
 * @author krystal
 * @date 2022/11/9 20:22
 */
public class Demo13 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int m = scanner.nextInt();
        int n = scanner.nextInt();
        if(m >= n){
            for (int i = n; i >= 1 ; i--) {
                if((m % i == 0) && (n % i == 0)){
                    System.out.println(i);
                    break;
                }
            }
        }else {
            for (int i = m; i >= 1 ; i--) {
                if((m % i == 0) && (n % i == 0)){
                    System.out.println(i);
                    break;
                }
            }
        }
    }
}
